﻿using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.Caching.MongoDB;
using System;
using System.Text;
using System.Text.RegularExpressions;

namespace MongoDBCacheProj
{
    class Program
    {
        static void Main(string[] args)
        {
            //MarkCBB.Extensions.Caching.MongoDB

            //MongoDBCache mongo = new MongoDBCache(new MongoDBCacheOptions()
            //{
            //    //ConnectionString = "mongodb://127.0.0.1:27017",
            //    ConnectionString = "mongodb://root:123456@127.0.0.1:27017",
            //    DatabaseName = "mydb",
            //    CollectionName = "mytest"
            //});


            //try
            //{
            //    mongo.SetString("username", "xiaoqiang",
            //    new DistributedCacheEntryOptions()
            //    {
            //        AbsoluteExpiration = DateTime.Now.AddDays(1)
            //    });

            //    var username = Encoding.UTF8.GetString(mongo.Get("username"));
            //}
            //catch (Exception ex)
            //{
            //    Console.WriteLine(ex.ToString());
            //}


            Console.ReadKey();
        }
    }
}
